Skip to content

Fixes #234: [Fleet Execution] [GitPatch Goals Review Example]#257

Merged
davideast merged 4 commits intomainfrom
fix-234-gitpatch-goals-example-16639661357293477856
Mar 10, 2026
Merged

Fixes #234: [Fleet Execution] [GitPatch Goals Review Example]#257
davideast merged 4 commits intomainfrom
fix-234-gitpatch-goals-example-16639661357293477856

Conversation

@davideast
Copy link
Collaborator

Fixes #234

This PR introduces the requested gitpatch-goals example into the packages/core/examples directory.

The new example showcases an advanced agent workflow using the Jules TypeScript SDK:

  1. Code Generation: Initiates a session asking for a basic Node.js HTTP server.
  2. GitPatch Extraction: Iterates through the session's activities to find changeSet artifacts and extracts the raw unified diff (gitPatch.unidiffPatch represented here via artifact.content). If no such artifact is present, it constructs a valid patch manually from the generatedFiles().
  3. Code Review: Feeds the extracted GitPatch and the original prompt into a second Jules session, instructing the agent to evaluate the patch against the initial goals and generic coding standards.

Changes:

  • Added packages/core/examples/gitpatch-goals/index.ts
  • Added packages/core/examples/gitpatch-goals/README.md
  • Added packages/core/examples/gitpatch-goals/package.json
  • Updated packages/core/README.md to link to the new example.

Testing:

  • Tested locally by building the SDK and running bun run index.ts within the example directory, which successfully initiates the generation and review sequence.
  • Verified that core SDK tests (npm run test --workspace=@google/jules-sdk) continue to pass.

PR created automatically by Jules for task 16639661357293477856 started by @davideast

Added a new practical example to the Jules TypeScript SDK demonstrating
how to use the session GitPatch data. The example shows how to use a
Repoless session to generate code, extract the resulting GitPatch (either
via the changeSet artifact or manually from generated files), and then
pass that patch to a second session for reviewing against the original
goals and coding standards.

- Created `packages/core/examples/gitpatch-goals/index.ts` containing the example logic.
- Created `packages/core/examples/gitpatch-goals/README.md` explaining the example.
- Created `packages/core/examples/gitpatch-goals/package.json` to configure the workspace module.
- Updated `packages/core/README.md` to include a link to the new example.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions github-actions bot added the fleet-merge-ready Ready for fleet sequential merge label Mar 10, 2026
@github-actions github-actions bot added this to the Examples milestone Mar 10, 2026
davideast and others added 3 commits March 10, 2026 01:07
Refactored the gitpatch-goals SDK example based on AI Agent DX best practices:
- Wrapped the example in the `citty` CLI framework.
- Applied the "Typed Service Contract" (Spec and Handler) pattern using
  Zod schema validation and explicit Result types for deterministic error
  handling.
- Removed reliance on `jules.select()` cache queries, opting instead to
  extract `changeSet` and `agentMessaged` activities directly from the
  awaited session snapshot (`session.result()`).
- Added a `--json` output flag to cater to agent-first readability.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
- Split `handler.ts` into discrete modules (`generate.ts`, `patch.ts`,
  `review.ts`) to avoid merge conflicts and promote code cleanliness.
- Implemented real-time progress streaming using `for await (const
  activity of session.stream())` to provide CLI feedback before
  sessions complete, rather than waiting entirely on `session.result()`.
- Maintained the Typed Service Contract pattern and JSON output formatting.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
- Added `--dry-run` to support input validation without executing
  costly or destructive Jules API mutations.
- Added `--describe` using `zod-to-json-schema` to allow agents to
  introspect the CLI schema dynamically at runtime.
- Added `SKILL.md` to document usage guidelines for agents, encouraging
  context window discipline via `--json` and input hardening via
  `--dry-run`.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@davideast davideast merged commit 51f0a35 into main Mar 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fleet-merge-ready Ready for fleet sequential merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fleet Execution] [GitPatch Goals Review Example]

1 participant